home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Balloons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  9.7 KB  |  240 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __BALLOONS__
  18. #define __BALLOONS__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <QuickdrawText.h>                                    */
  31.  
  32. #ifndef __MENUS__
  33. #include <Menus.h>
  34. #endif
  35. /*    #include <Memory.h>                                            */
  36. /*    #include <Events.h>                                            */
  37. /*        #include <OSUtils.h>                                    */
  38.  
  39. #ifndef __TEXTEDIT__
  40. #include <TextEdit.h>
  41. #endif
  42.  
  43. #ifndef __ERRORS__
  44. #include <Errors.h>
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if GENERATINGPOWERPC
  52. #pragma options align=mac68k
  53. #endif
  54.  
  55. #ifdef __CFM68K__
  56. #pragma lib_export on
  57. #endif
  58.  
  59.  
  60. enum {
  61.     hmBalloonHelpVersion        = 0x0002,                        /* The real version of the Help Manager */
  62.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  63.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help… */
  64.     kHMShowBalloonsItem            = 3,                            /* help menu item number of Show/Hide Balloons */
  65.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  66.     kBalloonWDEFID                = 126,                            /* Resource ID of the WDEF proc used in standard balloons */
  67. /* Dialog item template type constant */
  68.     helpItem                    = 1,                            /* key value in DITL template that corresponds to the help item */
  69. /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  70.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  71.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  72.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  73. };
  74.  
  75. enum {
  76.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  77.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  78.     hmMatchInTitle                = 16,                            /* for hwin resources, match string anywhere in window title string */
  79. /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  80.     kHMStringItem                = 1,                            /* pstring used in resource */
  81.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  82.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  83.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  84.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  85.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  86.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  87.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  88.     kHMTrackCntlItem            = 2048,                            /* Reserved */
  89. /* Constants for hmmHelpType's when filling out HMMessageRecord */
  90.     khmmString                    = 1,                            /* help message contains a PString */
  91.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  92.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  93.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  94.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  95.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  96.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  97.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  98. };
  99.  
  100. enum {
  101. /* ResTypes for Styled TE Handles in Resources */
  102.     kHMTETextResType            = 'TEXT',                        /* Resource Type of text data for styled TE record w/o style info */
  103.     kHMTEStyleResType            = 'styl'
  104. };
  105.  
  106. enum {
  107.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  108.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  109.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  110. /* Method parameters to pass to HMShowBalloon */
  111.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  112.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  113.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  114. };
  115.  
  116. enum {
  117. /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  118.     kHMMenuResType                = 'hmnu',                        /* ResType of help resource for supporting menus */
  119.     kHMDialogResType            = 'hdlg',                        /* ResType of help resource for supporting dialogs */
  120.     kHMWindListResType            = 'hwin',                        /* ResType of help resource for supporting windows */
  121.     kHMRectListResType            = 'hrct',                        /* ResType of help resource for rectangles in windows */
  122.     kHMOverrideResType            = 'hovr',                        /* ResType of help resource for overriding system balloons */
  123.     kHMFinderApplResType        = 'hfdr'
  124. };
  125.  
  126. struct HMStringResType {
  127.     short                            hmmResID;
  128.     short                            hmmIndex;
  129. };
  130. typedef struct HMStringResType HMStringResType;
  131.  
  132. struct HMMessageRecord {
  133.     SInt16                            hmmHelpType;
  134.     union {
  135.         Str255                            hmmString;
  136.         SInt16                            hmmPict;
  137.         TEHandle                        hmmTEHandle;
  138.         HMStringResType                    hmmStringRes;
  139.         SInt16                            hmmPictRes;
  140.         PicHandle                        hmmPictHandle;
  141.         SInt16                            hmmTERes;
  142.         SInt16                            hmmSTRRes;
  143.     } u;
  144. };
  145.  
  146. typedef struct HMMessageRecord HMMessageRecord;
  147.  
  148. typedef HMMessageRecord *HMMessageRecPtr;
  149.  
  150. typedef pascal OSErr (*TipFunctionProcPtr)(Point tip, RgnHandle structure, Rect *r, short *balloonVariant);
  151.  
  152. #if GENERATINGCFM
  153. typedef UniversalProcPtr TipFunctionUPP;
  154. #else
  155. typedef TipFunctionProcPtr TipFunctionUPP;
  156. #endif
  157.  
  158. enum {
  159.     uppTipFunctionProcInfo = kPascalStackBased
  160.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  161.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Point)))
  162.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(RgnHandle)))
  163.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect*)))
  164.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short*)))
  165. };
  166.  
  167. #if GENERATINGCFM
  168. #define NewTipFunctionProc(userRoutine)        \
  169.         (TipFunctionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  170. #else
  171. #define NewTipFunctionProc(userRoutine)        \
  172.         ((TipFunctionUPP) (userRoutine))
  173. #endif
  174.  
  175. #if GENERATINGCFM
  176. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  177.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  178. #else
  179. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  180.         (*(userRoutine))((tip), (structure), (r), (balloonVariant))
  181. #endif
  182.  
  183. /*  Public Interfaces  */
  184. extern pascal OSErr HMGetHelpMenuHandle(MenuHandle *mh)
  185.  THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  186. extern pascal OSErr HMShowBalloon(const HMMessageRecord *aHelpMsg, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, SInt16 balloonVariant, SInt16 method)
  187.  THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  188. extern pascal OSErr HMRemoveBalloon(void)
  189.  THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  190. extern pascal Boolean HMGetBalloons(void)
  191.  THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  192. extern pascal OSErr HMSetBalloons(Boolean flag)
  193.  THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  194. extern pascal OSErr HMShowMenuBalloon(SInt16 itemNum, SInt16 itemMenuID, SInt32 itemFlags, SInt32 itemReserved, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, SInt16 balloonVariant)
  195.  THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  196. extern pascal OSErr HMGetIndHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, UInt32 *options, Point *tip, Rect *altRect, SInt16 *theProc, SInt16 *balloonVariant, HMMessageRecord *aHelpMsg, SInt16 *count)
  197.  THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  198. extern pascal Boolean HMIsBalloon(void)
  199.  THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  200. extern pascal OSErr HMSetFont(SInt16 font)
  201.  THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  202. extern pascal OSErr HMSetFontSize(UInt16 fontSize)
  203.  THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  204. extern pascal OSErr HMGetFont(SInt16 *font)
  205.  THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  206. extern pascal OSErr HMGetFontSize(UInt16 *fontSize)
  207.  THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  208. extern pascal OSErr HMSetDialogResID(SInt16 resID)
  209.  THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  210. extern pascal OSErr HMSetMenuResID(SInt16 menuID, SInt16 resID)
  211.  THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  212. extern pascal OSErr HMBalloonRect(const HMMessageRecord *aHelpMsg, Rect *coolRect)
  213.  THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  214. extern pascal OSErr HMBalloonPict(const HMMessageRecord *aHelpMsg, PicHandle *coolPict)
  215.  THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  216. extern pascal OSErr HMScanTemplateItems(SInt16 whichID, SInt16 whichResFile, ResType whichType)
  217.  THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  218. extern pascal OSErr HMExtractHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, HMMessageRecord *aHelpMsg)
  219.  THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  220. extern pascal OSErr HMGetDialogResID(SInt16 *resID)
  221.  THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  222. extern pascal OSErr HMGetMenuResID(SInt16 menuID, SInt16 *resID)
  223.  THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  224. extern pascal OSErr HMGetBalloonWindow(WindowRef *window)
  225.  THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  226.  
  227. #ifdef __CFM68K__
  228. #pragma lib_export off
  229. #endif
  230.  
  231. #if GENERATINGPOWERPC
  232. #pragma options align=reset
  233. #endif
  234.  
  235. #ifdef __cplusplus
  236. }
  237. #endif
  238.  
  239. #endif /* __BALLOONS__ */
  240.